<template>
<div class="contain">
  <header class="hd-top">
    <h2 class="title">我的</h2>
  </header>
  <div class="page">
    <div class="mine-head displayflex" @click="gotoMsg">
      <div class="img">
        <img :src="userinfo.PictContent | filterImgUrl" v-if="userinfo.PictContent">
        <img src="~images/icon/people-ico.png" v-else>
      </div>
      <p class="name flex1">{{username}}</p>
    </div>
    <ul class="mine-list">
      <!-- <li class="displayflex" @click="goods" v-if="userinfo.UserBizType=='Cargowner'"><i class="iconfont icon-goods green"></i><span class="flex1">我的商品</span><i class="iconfont icon-right"></i></li>-->
      <!--<li class="displayflex" @click="custom" v-if="userinfo.UserBizType=='Cargowner'">
        <i class="iconfont icon-custom green2"></i>
        <span class="flex1">我的客户</span>
        <i class="iconfont icon-right"></i>
      </li> -->

      <router-link tag="li" class="displayflex" :to="{path:'/user/custom'}" v-if="userinfo.UserBizType=='Cargowner'">
        <i class="iconfont icon-custom green2"></i>
        <span class="flex1">人员管理</span>
        <i class="iconfont icon-right"></i>
      </router-link>

      <router-link tag="li" class="displayflex" 
        :to="{path:'/address',query:{type:'1',mine:true}}"
        v-if="userinfo.UserBizType=='Cargowner' || userinfo.UserBizType=='warehouse'">
        <i class="iconfont icon-send blue"></i>
        <span class="flex1">发货地址</span>
        <i class="iconfont icon-right"></i>
      </router-link>
      <router-link tag="li" class="displayflex" 
        :to="{path:'/address',query:{type:'2',mine:true}}"
        v-if="userinfo.UserBizType=='Cargowner' || userinfo.UserBizType=='warehouse'">
        <i class="iconfont icon-address green"></i>
        <span class="flex1">收货地址</span>
        <i class="iconfont icon-right"></i>
      </router-link>
      <router-link tag="li" class="displayflex" to='/user/settlement'
         v-if="userinfo.UserBizType=='Cargowner' || userinfo.UserBizType=='warehouse' || userinfo.UserBizType=='Driver'">
        <i class="iconfont icon-order green"></i>
        <span class="flex1">我的结算单</span>
        <i class="iconfont icon-right"></i>
      </router-link>

      <router-link tag="li" class="displayflex" 
        :to="{path:'password',query:{a:'1'}}">
        <i class="iconfont icon-password orange"></i>
        <span class="flex1">修改密码</span>
        <i class="iconfont icon-right"></i>
      </router-link>

      <router-link tag="li" class="displayflex" to="/user/set"><i class="iconfont icon-set purple"></i><span class="flex1">设置</span><i class="iconfont icon-right"></i></router-link>
      <li><a href="tel:0871-64116889" class="displayflex"><i class="iconfont icon-msg orange"></i><span class="flex1">联系客服</span><i class="iconfont icon-right"></i></a></li>
    </ul>
    <div class="exit" @click="exit">退出登录</div>
  </div>
  <foot-box :status="4" v-if="$route.query.type !== 'driver'"></foot-box>
</div>
</template>

<script>
import footBox from '@/components/share/footerbox.vue';
export default{
  components:{
    footBox
  },
  computed:{
    userinfo(){
      if(localStorage.UserInfo){
        return JSON.parse(localStorage.UserInfo)
      };
    },
    username(){
      if(this.userinfo) {
        return this.userinfo.Name || this.userinfo.LogonUser;
      } 
    },
  },
  methods:{
    gotoMsg(){
      this.$router.push({
        path:'/user/msg'
      })
    },
    // goods(){
    //   this.$router.push({
    //     path:'/user/goods'
    //   })
    // },
    // custom(){
    //   this.$router.push({
    //     path:'/user/custom'
    //   })
    // },
    exit(){
      sessionStorage.clear();
      localStorage.clear();
      this.$router.push({
        path:'/login'
      })
    }
  }
}
</script>